package com.spring.springdemo.springtest;

import javafx.application.Application;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestControllerq {

    @Resource(type = StudentFactory.class)
    private StudentFactory studentFactory;

    @RequestMapping("/aa")
    public void aa() throws Exception {
        Student object = (Student) studentFactory.getObject();
        System.out.println(object.getName());
    }

    public static void main(String[] args) {
        ApplicationContext application = new ClassPathXmlApplicationContext("spring.xml");
        Student student = application.getBean("student",Student.class);
        System.out.println(student);

        School school = application.getBean("school", School.class);
        System.out.println(school.getName());

    }

}
